package com.vint.mi;

import java.util.Stack;

/**
 */
public class Mi102 {
	private static String solution(String line) {
		if(!line.contains("mi"))
			return line;
		StringBuffer sb = new StringBuffer();
		int len = 0;
		for(int i = 0; i<line.length(); i++){
			if(sb.length()==0){
				sb.append(line.charAt(i));
				len++;
				continue;
			}
			if(sb.charAt(len-1)=='m'&&line.charAt(i)=='i'){
				sb.deleteCharAt(len-1);
				len--;
				continue;
			}
			len++;
			sb.append(line.charAt(i));
		}
		return sb.toString();
	}

	public static void main(String[] args){
		String src = "chuizimmmiioppo";
		System.out.println(solution(src));
	}
}
